package org.jhub1.system.xmpp.proxy;

import org.apache.commons.lang3.StringUtils;

public class ProcessResponse {
	public boolean error = false;
	public String errorMessage;
	public String resultMessage;

	public void setError(String errorMsg) {
		errorMessage = errorMsg;
		error = true;
	}
	
	public String getMessageXMLSafe() {
		return ProcessResponse.escapeHtml(resultMessage);
	}
	
	public static String escapeHtml(String str) {
		return StringUtils.replaceEach(str, new String[]{"&", "\"", "<", ">"}, new String[]{"&amp;", "&quot;", "&lt;", "&gt;"});
	}
	
}